#include"user.h"
#include<iostream>
#include"manage.h"
#include<iomanip>
extern ManageUser Man_user;
using namespace std;
int ID = 1000;
user::user(string name,int level,string phone,string address)
{

    ID = Man_user.findMaxID();
    m_ID = ++ID;
    this->m_name = name;
    this->m_passwd = "12345";
    this->m_level = level;
    this->m_phone = phone;
    this->m_address = address;
    this->m_balance = 0;
}
user::user(int ID,string name,string passwd,int level,string phone,string address)
{
    this->m_ID = ID;
    this->m_name = name;
    this->m_passwd = passwd;
    this->m_level = level;
    this->m_phone = phone;
    this->m_address = address;
    this->m_cost = 0;
    this->m_LoginTime = "首次登录";
    //this->m_balance = 100;

}

user::user(int ID,string name,string passwd,int level,string phone,string address,double cost,string LoginTime,double balance)
{
    this->m_ID = ID;
    this->m_name = name;
    this->m_passwd = passwd;
    this->m_level = level;
    this->m_phone = phone;
    this->m_address = address;
    this->m_cost = cost;
    this->m_LoginTime = LoginTime;
    this->m_balance = balance;
}
ostream& operator<<(ostream& out,user & u)
{
    out<<left<<setw(10)<<u.m_ID<<left<<setw(10)<<u.m_name
            <<left<<setw(15)<<u.m_phone<<left<<setw(10)
            <<u.m_address<<setw(10)<<u.m_balance;
    return out;
}
void user::showSelfInformation()
{
    cout<<"账号:"<<this->m_ID<<" 姓名:"<<this->m_name<<" 电话:"<<this->m_phone<<" 寄送地址:"<<this->m_address<<endl;
    if(this->m_level)
        cout<<"尊贵的VIP用户,您好！！"<<endl;
}